<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Consultations.ascx.cs" Inherits="MyCustomModules_Consultations" %>
<%@ Reference Control="~/MyCustomModules/MessageWidget.ascx" %>

<portal:HeadingControl ID="heading" runat="server" Text=" " />

<asp:UpdatePanel ID="UpdatePanelPersonal" UpdateMode="Conditional" runat="server">
    <ContentTemplate>

<script language="javascript" type="text/javascript" >
    <!--
    function showSubjectList(){
        document.getElementById( '<%=drpSubject.ClientID%>' ).style.display = '';
        return false;
    }
    function hideSubjectList(){
        document.getElementById( '<%=drpSubject.ClientID%>' ).style.display = 'none';
        var i = document.getElementById( '<%=drpSubject.ClientID%>' ).selectedIndex;
        
        var str="";
        if ( i>=0)
        {
            document.getElementById( '<%=txtNewSubject.ClientID%>' ).value = 0;
            str = document.getElementById( '<%=drpSubject.ClientID%>' ).options[i].text
            document.getElementById( '<%=txtNewSubject.ClientID%>' ).value = str;
        }
        
            
        // Loop through all elements inside Div Tag for message widget
        // Find div that has matching GroupingText as selected above.
        // Expand that div tab
        var div = document.getElementById('<%=pnlPostMessage.ClientID%>') ;
        var elms = div.getElementsByTagName("*");
        for(var i = 0, maxI = elms.length; i < maxI; ++i) {
            var elm = elms[i];
            if ( elm.id.indexOf("pnlSubject")>=0)
            {
                if ( elm.title == str)
                    elm.style.height="";
                else
                    elm.style.height="30px";
            }
            
        }
        
        return false;

    }
    
    function ExpandCollapse( obj)
    {
        if ( obj.style.height == "")
            obj.style.height="30px";
        else
            obj.style.height="";
    }
    
    function OpenPopUp(val) {
        var popupWidth = 700;
        var popupHeight = 575;
        var left = (screen.width / 2) - (popupWidth / 2);
        var top = (screen.height / 2) - (popupHeight / 2);
        var style = 'width=700,height=575,scrollbars=no,status=no,toolbar=no,resizable=no,location=no,menubar=no,directories=no, top=' + top + ', left=' + left ;
        window.open(val,'name',style);
        
        return false;
    }
    //-->
</script> 

<div>
    <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td width="90%">
                <table width="100%" cellpadding="0" cellspacing="0" border="0">
                    <tr>
                       
                        <td width="75%" align="top"> 
                            
                            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                <tr>
                                    <td Width="105">Send your query</td>
                                    <td Width="300" >
                                        
                                        <asp:ListBox ID="drpSubject" runat="server" Width="300" onclick="return hideSubjectList();" AutoPostBack="false" />
                                        <asp:TextBox ID="txtNewSubject" runat="server" Width="300"  ></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/DropDown.jpg" OnClick="return showSubjectList();" />
                                    </td>
 
                                </tr>
                            </table>
                             
                        </td>
                        
                        <td align="right" width="25%">
                            <asp:Image runat="server" ImageUrl="~/Images/Attachment.jpg" Width="25" onclick="OpenPopUp('MyCustomModules/UploadFiles.aspx');" />
                        </td>
                    </tr>
                </table>
                
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td >
                <asp:TextBox ID="txtMessage" TextMode="MultiLine" Height="50" Text="" runat="server" Width="100%"></asp:TextBox>
            </td>
            <td align="right" valign="bottom">
                <asp:Button ID="btnPostMessage" runat="server" Text="Submit" OnClick="btnPostMessage_Click" />
            </td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        <tr>
            <td colspan="2">
                <asp:Panel ID="pnlPostMessage" runat="server" BorderStyle="Solid" BorderWidth="1" Height="300" ScrollBars="Auto" BorderColor="darkgray" ></asp:Panel>
            </td>
        </tr>
    </table>
</div>
</ContentTemplate>
</asp:UpdatePanel>